<?php
/**
 * 
 * @author Todd
 *
 */
class Control_Account_view  extends Control_Account {
	function view() {
		$action = MooForm::request('action');
		if($action == 0) {
			MooView::render("accountView");
		} else if($action == 1) {
			$key 	= MooForm::request('key');
			$value 	= MooForm::request('value');
			
			if(empty($key) || empty($value)) {
				exit("参数不完整!");
			}
			
			$selectUserInfo = MooConfig::get('account.selectUserInfo');

			// 根据传递参数 获取sign
			$dataArr['key'] 	= $key; 
			$dataArr['value'] 	= $value; 
			$sign = $this->getSign($dataArr);
			
			//　根据 key value 查询到json数据 返回即可
			$url = $selectUserInfo . "&key=" . $key . "&value=" . $value . "&sign=" . $sign;
			
			$userInfoJson = MooUtil::curl_send($url);
			
			$userInfoJson = urldecode($userInfoJson);
			
			if($userInfoJson) {
				$userInfoData = MooJson::decode($userInfoJson, true);
				MooView::set('userInfoData', $userInfoData);
			}
			
			MooView::set($key, $value);
			
			MooView::render('accountView');
		}
	}
}